package state.person.events;

import messages.ByteList;
import messages.CString;
import state.group.events.EventType;

public class GoingOutEvent extends BasePersonEvent {
    
    private byte floor;
    
    public GoingOutEvent(byte[] data, int startIndex)
    {
        super(data, startIndex);
        floor = data[2 + personId.getLength()];
    }
    
    public GoingOutEvent(CString personId, byte floor)
    {
        super(personId);
        this.floor = floor;
    }
    
    public byte getFloor()
    {
        return floor;
    }
    
    public void appendToByteList(ByteList list)
    {
        super.appendToByteList(list);
        list.addByte(floor);
    }
    
    @Override
    public int getEventByteLength()
    {
        return 2 + personId.getLength();
    }

    @Override
    public EventType getEventType()
    {
        return EventType.GoingOutEvent;
    }
    
}
